#ifndef _DISTANCE_H
#define _DISTANCE_H

#include "Sample.h"

class Distance {
public:
    enum DistanceType {
        EUCLIDEAN = 0
    };

    DistanceType getDistanceType() {
        return m_type;
    }
    
    virtual float calcDistance(const Sample &s1, const Sample &s2) = 0;

    /**
     * calculate the distance between s1 and s2, and output the result in out pointer if returned value
     * is true, which means the distance is below threshold.
     *
     * If returned value is false, the value in out pointer is undefined, but we can draw that the distance
     * between s1 and a2 is beyond the threshold.
     */
    virtual bool calcDistance2(const Sample &s1, const Sample &s2, float &out, float threshold) = 0;

    virtual ~Distance(void) {
    };

protected:
    DistanceType m_type;
    
    int m_dim;

    Distance(int dim) {
        m_dim = dim;
    }

};

#endif
